#include "widget.h"
#include <QLabel>
#include <QListWidget>
#include <QHBoxLayout>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    label = new QLabel(this);
    label->setFixedWidth(70);
    listWidget = new QListWidget(this);
    new QListWidgetItem(tr("Chrome"),listWidget);
    new QListWidgetItem(tr("Firefox"),listWidget);

    listWidget->addItem(new QListWidgetItem(tr("IE")));
    listWidget->addItem(new QListWidgetItem(tr("Netscape")));
    listWidget->addItem(new QListWidgetItem(tr("Opera")));
    listWidget->addItem(new QListWidgetItem(tr("Safari")));
    listWidget->addItem(new QListWidgetItem(tr("TheWorld")));
    listWidget->addItem(new QListWidgetItem(tr("Traveler")));

    QListWidgetItem *newItem = new QListWidgetItem;
    newItem->setText(tr("Maxthon"));
    listWidget->insertItem(3,newItem);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(label);
    layout->addWidget(listWidget);
    setLayout(layout);
    connect(listWidget,SIGNAL(currentTextChanged(QString)),label,SLOT(setText(QString)));
}

Widget::~Widget()
{

}
